<template>
	<view class="TUI-MapMessage" :class="'map-message ' + (isMine?'my-map':'')" @tap="openLocation">
		<image src="/static/static/images/map.png" class="map-icon"></image>
		<view class="map-text">
			<view class="map-title">{{LocationPayload.description}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				LocationPayload:{}
			};
		},

		components: {}, 
		props: {
			message: {
				type: Object,
				default: ''
			},
			isMine: {
				type: Boolean,
				default: true
			}
		},
		watch: {
			message: {
				handler: function(newVal) {
					// console.log(33333333333333,newVal)
					this.setData({
						LocationPayload: newVal.payload
					})
				},
				immediate: true,
				deep: true
			}
		},
		methods: {
			openLocation() {
				uni.openLocation({
					longitude: this.LocationPayload.longitude,
					latitude: this.LocationPayload.latitude
				});
			}
		}
	}
</script>
<style>
	@import "./index.css";
</style>
